package ar.com.larreta.vista.client;

import gwtupload.client.IUploader;

import java.util.HashMap;
import java.util.Map;

import com.extjs.gxt.ui.client.messages.XMessages;
import com.google.gwt.user.client.rpc.AsyncCallback;

public class Mensajes implements XMessages, IUploader.UploaderConstants {
	
	public static final String PARAM0 = "{0}";
	public static final String PARAM1 = "{1}";
	public static final String PARAM2 = "{2}";
	public static final String PARAM3 = "{3}";
	public static final String PARAM4 = "{4}";
	public static final String PARAM5 = "{5}";
	
	private Map<String, String> mensajes;
	private MensajesListener listener;

	private static Mensajes instancia;
	
	public static Mensajes getInstancia(MensajesListener listener, AsyncCallback retornoDeLlamada){
		if (instancia==null){
			instancia =  new Mensajes(listener, retornoDeLlamada);
			instancia.mensajes = new HashMap<String, String>();
		}
		return instancia;
	} 

	public static Mensajes getInstancia(){
		return instancia;
	} 
	
	private  Mensajes(MensajesListener listener, AsyncCallback retornoDeLlamada){
		this.listener = listener;
		listener.cargarMensajes(retornoDeLlamada);
	}
	
	public Map<String, String> getMensajes() {
		return mensajes;
	}
	
	public String get(String key){
		String mensaje = (String)mensajes.get(key);
		if (mensaje==null){
			mensajes.put(key, key);
			listener.mensajeNoEncontrado(key);
			return key;
		}
		return mensaje;
	}

	public String updateManager_indicatorText() {
		return get("updateManager_indicatorText");
	}

	public String grid_ddText(int rows) {
		return get("grid_ddText").replace(PARAM0, new Integer(rows).toString());	
	}

	public String tabPanelItem_closeText() {
		return get("tabPanelItem_closeText");
	}

	public String tabPanelItem_closeOtherText() {
		return get("tabPanelItem_closeOtherText");
	}

	public String field_invalidText() {
		return get("field_invalidText");
	}

	public String loadMask_msg() {
		return get("loadMask_msg");
	}

	public String messageBox_ok() {
		return get("messageBox_ok");
	}

	public String messageBox_cancel() {
		return get("messageBox_cancel");
	}

	public String messageBox_yes() {
		return get("messageBox_yes");
	}

	public String messageBox_no() {
		return get("messageBox_no");
	}

	public String messageBox_close() {
		return get("messageBox_close");
	}

	public String datePicker_todayText() {
		return get("datePicker_todayText");
	}

	public String datePicker_minText() {
		return get("datePicker_minText");
	}

	public String datePicker_maxText() {
		return get("datePicker_maxText");
	}

	public String datePicker_disabledDaysText() {
		return get("datePicker_disabledDaysText");
	}

	public String datePicker_disabledDatesText() {
		return get("datePicker_disabledDatesText");
	}

	public String datePicker_nextText() {
		return get("datePicker_nextText");
	}

	public String datePicker_prevText() {
		return get("datePicker_prevText");
	}

	public String datePicker_monthYearText() {
		return get("datePicker_monthYearText");
	}

	public String datePicker_todayTip(String date) {
		return get("datePicker_todayTip");
	}

	public String datePicker_okText() {
		return get("datePicker_okText");
	}

	public String datePicker_cancelText() {
		return get("datePicker_cancelText");
	}

	public String datePicker_startDay() {
		return get("datePicker_startDay");
	}

	public String colorPalette() {
		return get("colorPalette");
	}

	public String pagingToolBar_beforePageText() {
		return get("pagingToolBar_beforePageText");
	}

	public String pagingToolBar_afterPageText(int pages) {
		return get("pagingToolBar_afterPageText").replace("{0}", Integer.valueOf(pages).toString());
	}

	public String pagingToolBar_firstText() {
		return get("pagingToolBar_firstText");
	}

	public String pagingToolBar_prevText() {
		return get("pagingToolBar_prevText");
	}

	public String pagingToolBar_nextText() {
		return get("pagingToolBar_nextText");
	}

	public String pagingToolBar_lastText() {
		return get("pagingToolBar_lastText");
	}

	public String pagingToolBar_refreshText() {
		return get("pagingToolBar_refreshText");
	}

	public String panel_expandPanel() {
		return get("panel_expandPanel");
	}

	public String panel_collapsePanel() {
		return get("panel_collapsePanel");
	}

	public String pagingToolBar_displayMsg(int start, int end, int total) {
		return get("pagingToolBar_displayMsg").replace(PARAM0, new Integer(start).toString()).replace(PARAM1, new Integer(end).toString()).replace(PARAM2, new Integer(total).toString());
	}

	public String pagingToolBar_emptyMsg() {

		return get("pagingToolBar_emptyMsg");
	}

	public String textField_minLengthText(int length) {

		return get("textField_minLengthText");
	}

	public String textField_maxLengthText(int length) {

		return get("textField_maxLengthText").replace(PARAM0, new Integer(length).toString());
	}

	public String textField_blankText() {

		return get("textField_blankText");
	}

	public String textField_regexText() {

		return get("textField_regexText");
	}

	public String textField_emptyText() {

		return get("textField_emptyText");
	}

	public String checkBoxGroup_text(String fieldLabel) {

		return get("checkBoxGroup_text").replace(PARAM0, fieldLabel);
	}

	public String radioGroup_text(String fieldLabel) {

		return get("radioGroup_text").replace(PARAM0, fieldLabel);
	}

	public String uploadField_browseText() {

		return get("uploadField_browseText");
	}

	public String numberField_minText(double min) {

		return get("numberField_minText").replace(PARAM0, new Double(min).toString());
	}

	public String numberField_maxText(double max) {

		return get("numberField_maxText").replace(PARAM0, new Double(max).toString());
	}

	public String numberField_nanText(String num) {

		return get("numberField_nanText").replace(PARAM0, num);
	}

	public String numberField_negativeText() {

		return get("numberField_negativeText");
	}

	public String dateField_disabledDaysText() {

		return get("dateField_disabledDaysText");
	}

	public String dateField_disabledDatesText() {

		return get("dateField_disabledDatesText");
	}

	public String dateField_minText(String min) {

		return get("dateField_minText").replace(PARAM0, min);
	}

	public String dateField_maxText(String max) {

		return get("dateField_maxText").replace(PARAM0, max);
	}

	public String dateField_invalidText(String date, String format) {

		return get("dateField_invalidText").replace(PARAM0, date).replace(PARAM1, format);
	}

	public String comboBox_loading() {

		return get("comboBox_loading");
	}

	public String listField_moveSelectedUp() {

		return get("listField_moveSelectedUp");
	}

	public String listField_moveSelectedDown() {

		return get("listField_moveSelectedDown");
	}

	public String listField_addAll() {

		return get("listField_addAll");
	}

	public String listField_addSelected() {

		return get("listField_addSelected");
	}

	public String listField_removeAll() {

		return get("listField_removeAll");
	}

	public String listField_removeSelected() {

		return get("listField_removeSelected");
	}

	public String listField_itemsSelected() {

		return get("listField_itemsSelected");
	}

	public String htmlEditor_boldTipText() {

		return get("htmlEditor_boldTipText");
	}

	public String htmlEditor_boldTipTitle() {

		return get("htmlEditor_boldTipTitle");
	}

	public String htmlEditor_italicTipText() {

		return get("htmlEditor_italicTipText");
	}

	public String htmlEditor_italicTipTitle() {

		return get("htmlEditor_italicTipTitle");
	}

	public String htmlEditor_underlineTipText() {

		return get("htmlEditor_underlineTipText");
	}

	public String htmlEditor_underlineTipTitle() {

		return get("htmlEditor_underlineTipTitle");
	}

	public String htmlEditor_justifyLeftTipText() {

		return get("htmlEditor_justifyLeftTipText");
	}

	public String htmlEditor_justifyLeftTipTitle() {

		return get("htmlEditor_justifyLeftTipTitle");
	}

	public String htmlEditor_justifyCenterTipText() {

		return get("htmlEditor_justifyCenterTipText");
	}

	public String htmlEditor_justifyCenterTipTitle() {

		return get("htmlEditor_justifyCenterTipTitle");
	}

	public String htmlEditor_justifyRightTipText() {

		return get("htmlEditor_justifyRightTipText");
	}

	public String htmlEditor_justifyRightTipTitle() {

		return get("htmlEditor_justifyRightTipTitle");
	}

	public String htmlEditor_sourceEditTipText() {

		return get("htmlEditor_sourceEditTipText");
	}

	public String htmlEditor_sourceEditTipTitle() {

		return get("htmlEditor_sourceEditTipTitle");
	}

	public String htmlEditor_olTipText() {

		return get("htmlEditor_olTipText");
	}

	public String htmlEditor_olTipTitle() {

		return get("htmlEditor_olTipTitle");
	}

	public String htmlEditor_ulTipText() {

		return get("htmlEditor_ulTipText");
	}

	public String htmlEditor_ulTipTitle() {

		return get("htmlEditor_ulTipTitle");
	}

	public String htmlEditor_linkTipText() {

		return get("htmlEditor_linkTipText");
	}

	public String htmlEditor_linkTipTitle() {

		return get("htmlEditor_linkTipTitle");
	}

	public String htmlEditor_createLinkText() {

		return get("htmlEditor_createLinkText");
	}

	public String htmlEditor_increaseFontSizeTipText() {

		return get("htmlEditor_increaseFontSizeTipText");
	}

	public String htmlEditor_increaseFontSizeTipTitle() {

		return get("htmlEditor_increaseFontSizeTipTitle");
	}

	public String htmlEditor_decreaseFontSizeTipText() {

		return get("htmlEditor_decreaseFontSizeTipText");
	}

	public String htmlEditor_decreaseFontSizeTipTitle() {

		return get("htmlEditor_decreaseFontSizeTipTitle");
	}

	public String htmlEditor_foreColorTipText() {

		return get("htmlEditor_foreColorTipText");
	}

	public String htmlEditor_foreColorTipTitle() {

		return get("htmlEditor_foreColorTipTitle");
	}

	public String htmlEditor_backColorTipText() {

		return get("htmlEditor_backColorTipText");
	}

	public String htmlEditor_backColorTipTitle() {

		return get("htmlEditor_backColorTipTitle");
	}

	public String gridView_sortAscText() {

		return get("gridView_sortAscText");
	}

	public String gridView_sortDescText() {

		return get("gridView_sortDescText");
	}

	public String gridView_columnsText() {

		return get("gridView_columnsText");
	}

	public String groupingView_emptyGroupText() {

		return get("groupingView_emptyGroupText");
	}

	public String groupingView_groupByText() {

		return get("groupingView_groupByText");
	}

	public String groupingView_showGroupsText() {

		return get("groupingView_showGroupsText");
	}

	public String rowEditor_cancelText() {

		return get("rowEditor_cancelText");
	}

	public String rowEditor_dirtyText() {

		return get("rowEditor_dirtyText");
	}

	public String rowEditor_saveText() {

		return get("rowEditor_saveText");
	}

	public String rowEditor_tipTitleText() {

		return get("rowEditor_tipTitleText");
	}

	public String propertyColumnModel_nameText() {

		return get("propertyColumnModel_nameText");
	}

	public String propertyColumnModel_valueText() {

		return get("propertyColumnModel_valueText");
	}

	public String borderLayout_splitTip() {
		return get("borderLayout_splitTip");
	}

	public String borderLayout_collapsibleSplitTip() {
		return get("borderLayout_collapsibleSplitTip");
	}

	public String themeSelector_blueTheme() {
		return get("themeSelector_blueTheme");
	}

	public String themeSelector_grayTheme() {
		return get("themeSelector_grayTheme");
	}

	public String desktop_startButton() {
		return get("desktop_startButton");
	}

	public String window_ariaResize() {
		return get("window_ariaResize");
	}

	public String window_ariaMove() {
		return get("window_ariaMove");
	}

	public String window_ariaResizeDescription() {
		return get("window_ariaResizeDescription");
	}

	public String window_ariaMoveDescription() {
		return get("window_ariaMoveDescription");
	}

	public String aria_leaveApplication() {
		return get("aria_leaveApplication");
	}

	public String stringFilter_emptyText() {
		return get("stringFilter_emptyText");
	}

	public String booleanFilter_noText() {
		return get("booleanFilter_noText");
	}

	public String booleanFilter_yesText() {
		return get("booleanFilter_yesText");
	}

	public String dateFilter_afterText() {

		return get("dateFilter_afterText");
	}

	public String dateFilter_beforeText() {
		return get("dateFilter_beforeText");
	}

	public String dateFilter_onText() {
		return get("dateFilter_onText");
	}

	public String numericFilter_emptyText() {
		return get("numericFilter_emptyText");
	}

	public String gridFilters_filterText() {
		return get("gridFilters_filterText");
	}

	public String uploadLabelCancel() {
		return get("uploadLabelCancel");
	}

	public String uploadStatusCanceled() {
		return get("uploadStatusCanceled");
	}

	public String uploadStatusCanceling() {
		return get("uploadStatusCanceling");
	}

	public String uploadStatusDeleted() {
		return get("uploadStatusDeleted");
	}

	public String uploadStatusError() {
		return get("uploadStatusError");
	}

	public String uploadStatusInProgress() {
		return get("uploadStatusInProgress");
	}

	public String uploadStatusQueued() {
		return get("uploadStatusQueued");
	}

	public String uploadStatusSubmitting() {
		return get("uploadStatusSubmitting");
	}

	public String uploadStatusSuccess() {
		return get("uploadStatusSuccess");
	}

	public String uploaderActiveUpload() {
		return get("uploaderActiveUpload");
	}

	public String uploaderAlreadyDone() {
		return get("uploaderAlreadyDone");
	}

	public String uploaderBlobstoreError() {
		return get("uploaderBlobstoreError");
	}

	public String uploaderBrowse() {
		return get("uploaderBrowse");
	}

	public String uploaderInvalidExtension() {
		return get("uploaderInvalidExtension");
	}

	public String uploaderSend() {
		return get("uploaderSend");
	}

	public String uploaderServerError() {
		return get("uploaderServerError");
	}

	public String uploaderServerUnavailable() {
		return get("uploaderServerUnavailable");
	}

	public String uploaderTimeout() {
		return get("uploaderTimeout");
	}

}
